package chxy.sys.service.impl;

import chxy.sys.mapper.NoteTakingMapper;
import chxy.sys.model.Users;
import chxy.sys.mapper.UsersMapper;
import chxy.sys.service.UsersService;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author SR.Y
 * @since 2021-03-13
 */
@Service
public class UsersServiceImpl extends ServiceImpl<UsersMapper, Users> implements UsersService {
    @Autowired
    private UsersMapper usmapper;



    @Override
    public List<Users> findByNP(Users u) {
        System.out.println(u.getUname()+"==="+u.getPwd());
        return usmapper.findByNp(u);
    }

    @Override
    public boolean create(Users u) {
        return save(u);
    }


    @Override
    public boolean update(Users u) {
        return updateById(u);
    }

    @Override
    public boolean delete(Users u) {

        return removeById(u.getId());
    }

    @Override
    public Page<Users > list(Integer pageSize, Integer pageNum) {
        Page<Users > page = new Page<>(pageNum,pageSize);
        return page(page);
    }
}
